<style>
.option-picker .fui-navbar .cartbtn {
    padding-right:0.3rem;background:#fff;opacity:1
}

.option-picker .fui-navbar .buybtn, .option-picker .fui-navbar .confirmbtn {
    padding-left:0.3rem;background:#fff
}
.fee-tag-nav, .fee-tagup-nav, .fee-disabled-nav {border-radius:1rem;height:2rem;line-height:2rem;color:#fff;width:100%;font-weight:400;font-size:0.7rem;margin:0.2rem 0;padding:0 0.2rem}
.fee-tagup {background:{{main.syscolor || 'red'}};color:#fff;width:auto;font-weight:400;font-size:0.55rem}
.fee-tag-nav {background:{{main.syscolor || 'red'}}; opacity: 0.58;}
.fee-tagup-nav {background:{{main.syscolor || 'red'}};}
.fee-disabled-nav {background:#bbb;color:#fff;}	
</style>
<div class="option-picker">
	<div class="option-picker-inner">
		<div class="option-picker-cell goodinfo">
			<div class="closebtn" ng-click="goodspagedata.showpicker=false"><i class="icon icon-guanbi1"></i></div>
			<div class="img"><img class='thumb' ng-src="{{tomedia(goodspagedata.goods.image) || '../core/resource/images/nopic.jpg'}}" /></div>
			<div class="info info-price text-danger">
					<span>
						￥
						<span class='price' style="font-size:1rem;font-weight:600">
						{{goodspagedata.options.price || '0.00'}}
						</span>
						<span ng-if="goodspagedata.options.oldprice" class='delete'>
						原价：{{goodspagedata.options.oldprice || '0.00'}}
						</span>
					</span>
			</div>
			<div ng-if="goodspagedata.goods.isshowsales=='1'" class="info info-total">
					<span>库存 
					<span class='total'>{{goodspagedata.options.stock || 0}}</span>
					<span ng-if="goodspagedata.options.unit">{{goodspagedata.options.unit}}</span>
					<span ng-if="!goodspagedata.options.unit">{{goodspagedata.goods.unit || '件'}}</span>
					</span>
			</div>
			<div class="info info-titles" ng-if="goodspagedata.selespename">
				当前选择：{{goodspagedata.selespename}} 
			</div>
			<div ng-if="goodspagedata.goods.istaocan==1" class="red" style="font-size:0.6rem">(含{{goodspagedata.options.goodsnum ||0}}<span>{{goodspagedata.goods.unit || '件'}}</span>商品)</div>
		</div>
		<div class="option-picker-options modal-swiper-y">
			<div ng-if="goodspagedata.goods.istaocan!=1" ng-repeat="(k,spec) in goodspagedata.specs_list" class="option-picker-cell option spec">
			<div class="title">{{spec.title}}</div>
			<div class="select">
				 <a ng-repeat="item in spec.items" href="javascript:;" ng-click="goodspagedata.post.specid[k]=item.id;goodspagedata.get_optionsid();" ng-class="{'btn btn-default btn-sm nav spec-item':1,'btn-select':goodspagedata.post.specid[k]==item.id}"> {{item.title}} </a>
			</div>
			</div>
			<div ng-if="goodspagedata.goods.istaocan==1" class="option-picker-cell option spec">
			<div class="select">
				 <a ng-repeat="spec in goodspagedata.specs_list" href="javascript:;" ng-click="goodspagedata.settaocan(spec);" ng-class="{'btn btn-default btn-sm nav spec-item':1,'btn-select':goodspagedata.post.optionsid==spec.id}"> {{spec.title}} </a>
			</div>
			</div>
			<div class="fui-cell-group noborder" style="margin-top:0">
				<div class="fui-cell noborder">
				<div class="fui-cell-label">数量</div>
				<div class="fui-cell-info"></div>
				<div class="fui-cell-mask noremark">
					 <div class="fui-number">
						<div class="minus" ng-click="goodspagedata.minus()">-</div>
						<input class="num" type="text" name="" ng-model="goodspagedata.post.num"/>
						<div class="plus" ng-click="goodspagedata.plus()">+</div>
					</div>
				</div>
				<div style="line-height:1.5rem;color:#999;font-size:0.6rem;padding-left:0.2rem">
					<span ng-if="goodspagedata.options.unit">{{goodspagedata.options.unit}}</span>
					<span ng-if="!goodspagedata.options.unit">{{goodspagedata.goods.unit || '件'}}</span>
				</div>
				</div>
			</div>
		</div>
		<div class="fui-navbar" style="-webkit-box-shadow:0 0 0 rgba(0,0,0,0.1);">
			<a ng-if="(goodspagedata.isnewtpl!=1 || goodspagedata.isfromcart==1) && goodspagedata.options.stock>0 && (goodspagedata.canAddCart || goodspagedata.post.isdish) && goodspagedata.goods.canbuy" aria-hidden="true" data-dismiss="modal" href="javascript:;" ng-click="goodspagedata.pickeraddtocart()" class="nav-item btn cartbtn">
				<div ng-class="{'fee-tag-nav':goodspagedata.isfromcart!=1,'fee-tagup-nav':goodspagedata.isfromcart==1}">
					加入购物车
				</div>
			</a>
			<a ng-if="goodspagedata.isfromcart!=1 && !goodspagedata.post.isdish && goodspagedata.options.stock>0 && goodspagedata.post.num<=goodspagedata.options.stock && (!goodspagedata.seckillinfo ||  goodspagedata.seckillinfo.status!=1) && goodspagedata.goods.canbuy" aria-hidden="true" data-dismiss="modal" href="javascript:;" ng-click="goodspagedata.check_buy()" class="nav-item btn buybtn">
				<div class="fee-tagup-nav">
					立刻购买
				</div>
			</a>
			<a ng-if="goodspagedata.options.stock<1 || (goodspagedata.post.num>goodspagedata.options.stock) || !goodspagedata.goods.canbuy" class="nav-item btn cartbtn">
				<div class="fee-disabled-nav">
					{{goodspagedata.goods.nobuytitle}}
				</div>
			</a>
		</div>
    </div>	
</div>
<script type="text/javascript">
scope.goodspagedata.settaocan=function(options){
			scope.goodspagedata.post.optionsid=options.id;
			scope.goodspagedata.options=options;
			scope.goodspagedata.goods.price=options.price;
			scope.goodspagedata.goods.image=options.thumb?options.thumb:scope.goodspagedata.goods.image;
			scope.goodspagedata.goods.originalprice=options.productprice;
			scope.goodspagedata.selespename=options.title;
			scope.$evalAsync();
}
scope.goodspagedata.pickeraddtocart=function(){
	scope.post_json('jy_weishop/goods.detail/addtocart/isres=1',scope.goodspagedata.post,function (res){
		scope.message('成功加入购物车！');
		scope.goodspagedata.cartnums=res.cartnums;
		scope.goodspagedata.cartCount=res.cartnums;
		if(scope.main.menus && scope.main.menus.length>0){
			for(var i=0;i<scope.main.menus.length;i++){
				var action=scope.main.menus[i].action
				if(action.indexOf("jy_weishop/member.cart") != -1){
					var key=i;
					scope.main.menus[key].nums=scope.goodspagedata.cartnums
				}
			}
		}
		scope.goodspagedata.showpicker=false
		scope.$evalAsync();
	})
}
</script>